package com.atguigu.javase.thread;

import lombok.Data;

@Data
public class Deposit implements Runnable {

    private Account account;

    public Deposit() {

    }

    public Deposit(Account account) {
        super();
        this.account = account;
    }

    @Override
    public void run() {
        for (int i = 0; i <3 ; i++) {
            synchronized ("") {

            int balance = account.getBalance();
            balance += 1000;
            account.setBalance(balance);

            System.out.println(Thread.currentThread().getName() +"存完钱后："+account);

            try {
                Thread.sleep(10);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            }
        }

    }
}
